package com.cadre.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cadre.common.utils.SecurityUtils;
import com.cadre.common.utils.oldutil.PageUtils;
import com.cadre.common.utils.oldutil.Query;
import com.cadre.system.domain.officer.A01;
import com.cadre.system.domain.officer.Archives;
import com.cadre.system.domain.officer.ConfernamelistEntity;
import com.cadre.system.domain.officer.tabMenu;
import com.cadre.system.mapper.NEWConfernamelistMapper;
import com.cadre.system.service.NEWConfernamelistService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

@Service("NEWConfernamelistService")
public class NEWConfernamelistServiceImpl extends ServiceImpl<NEWConfernamelistMapper, ConfernamelistEntity> implements NEWConfernamelistService {
    @Autowired
    private NEWConfernamelistMapper confernamelistMapper;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        return new PageUtils(this.baseMapper.selectPage(new Query(params).getPage(), new LambdaQueryWrapper<>()));
    }

    @Override
    public List<ConfernamelistEntity> getListByBatchId(Map<String, Object> param) {
        return this.baseMapper.getListByBatchId(param);
    }

    @Override
    public List<ConfernamelistEntity> getConfernamelist(String batchId, Long deptId) {
        LambdaQueryWrapper<ConfernamelistEntity> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.eq(ConfernamelistEntity::getBatchid, batchId);
        lambdaQueryWrapper.eq(ConfernamelistEntity::getSubmissdept, deptId);
        return this.baseMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<tabMenu> tabmenu(String batchid) {
        return this.baseMapper.tabmenu(batchid);
    }

    @Override
    @Transactional(rollbackFor = {Exception.class})
    public int updateByPrimaryKeySelective(ConfernamelistEntity record) {
        return this.confernamelistMapper.updateByPrimaryKeySelective(record);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public List<ConfernamelistEntity> selectByMaps(Map<String, Object> map) {
        return this.confernamelistMapper.selectByMaps(map);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public List<ConfernamelistEntity> getListAll() {
        return this.confernamelistMapper.getListAll();
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    @Transactional(rollbackFor = {Exception.class})
    public int updateOftenbatchId(String id, String[] ids) {
        return this.confernamelistMapper.updateOftenbatchId(id, ids);
    }

    @Override
    public List<ConfernamelistEntity> getListForOften(String oftenbatchid) {
        return this.confernamelistMapper.getListForOften(oftenbatchid);
    }

    @Override
    public List<A01> selectListByName(Map<String, Object> map) {
        String att1;
        map.put("userid", SecurityUtils.getUserId());
        Object ids = map.get("ids");
        if (null != ids) {
            map.put("ids", Arrays.asList(StringUtils.split((String) ids, ",")));
        }
        Object a0181s = map.get("a0181s");
        if (null != a0181s) {
            map.put("a0181s", Arrays.asList(StringUtils.split((String) a0181s, ",")));
        }
        String att12 = (String) map.get("name");
        new ArrayList();
        if (!(!StringUtils.isNotBlank(att12) || (att1 = att12.trim().replaceAll("，", ",").toUpperCase()) == null || att1.length() == 0)) {
            map.put("names", Arrays.asList(att1.split(",")));
        }
        return this.confernamelistMapper.selectListByAddMeetUser(map);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public int selectMaxSort(String batchId) {
        return this.confernamelistMapper.selectMaxSort(batchId);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public int selectMaxOftenSort(String batchId) {
        return this.confernamelistMapper.selectMaxOftenSort(batchId);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public List<A01> selectA01ListByPerSonIds(List<String> asListString, String batchId, String flag) {
        return this.confernamelistMapper.selectA01ListByPerSonIds(asListString, batchId, flag);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public Object getA01Value(String personId, String column) {
        return Integer.valueOf(this.confernamelistMapper.getA01Value(personId, column));
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    @Transactional(rollbackFor = {Exception.class})
    public int updateResultByBathid(String batchid, String result) {
        return this.confernamelistMapper.updateResultByBathid(batchid, result);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    @Transactional(rollbackFor = {Exception.class})
    public int updateOftenresultByOftenbatchid(String oftenbatchid, String oftenResult) {
        return this.confernamelistMapper.updateOftenresultByOftenbatchid(oftenbatchid, oftenResult);
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public List<Archives> getListForMeetBW() {
        return this.confernamelistMapper.getListForMeetBW();
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public List<Archives> getListForMeetCW() {
        return this.confernamelistMapper.getListForMeetCW();
    }

    @Override // com.tdqy.cadre.modular.profess.service.NEWConfernamelistService
    public List<Archives> getSynchroYList() {
        return this.confernamelistMapper.getSynchroYList();
    }
}
